Fix Java example template to properly wrap long scenario names in comments#3305
Merged
Fix Java example template to properly wrap long scenario names in comments#3305
Conversation
AxelGeist
approved these changes
Dec 11, 2025
…ments When scenario names exceed 120 characters, the wordwrap filter was creating a new line without the comment prefix '//'. This caused Java compilation errors like 'class, interface, enum, or record expected'. The fix adds the wrapstring parameter to preserve the comment prefix on wrapped lines.
6f6a754 to
943bd76
Compare
Member
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
This pull request was merged directly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes a code generation issue where long scenario names (>120 characters) in Java examples were being word-wrapped incorrectly, causing Java compilation errors.
Problem
When a scenario name exceeds 120 characters, the Jinja2
wordwrapfilter was creating a new line without preserving the comment prefix//. This resulted in invalid Java syntax like:The word
responseon line 2 is not valid Java syntax, causing compilation errors:Solution
Updated the
example.j2template to use thewrapstringparameter in thewordwrapfilter:// {{ scenario.name|wordwrap(width=120, wrapstring='\n// ')}}This ensures that when the scenario name wraps to a new line, it preserves the
//comment prefix, resulting in valid Java code:Related PRs
This fixes the compilation errors seen in:
Testing
After this fix is merged, the generated Java examples for PR #3291 should compile successfully.